﻿using Ah.Testudin.Engine.Events;
using Microsoft.Xna.Framework;

namespace Ah.Testudin.Engine.Processes
{
    public class TriggerEventProcess : ProcessBase
    {
        #region Private Member Variables

        private ITestudinEvent _event;

        private readonly IEventManager _eventManager;

        #endregion

        #region Constructors

        public TriggerEventProcess(
            ITestudinEvent testudinEvent,
            IEventManager eventManager)
            : this(testudinEvent, eventManager, null)
        {
        }

        public TriggerEventProcess(
            ITestudinEvent testudinEvent,
            IEventManager eventManager,
            IProcess childProcess)
            : base(childProcess)
        {
            _event = testudinEvent;

            _eventManager = eventManager;
        }

        #endregion

        #region ProcessBase

        public override void Update(GameTime gameTime)
        {
            _eventManager.TriggerEvent(_event);
        }

        #endregion
    }
}
